﻿using System.Collections.ObjectModel;
using CommunityToolkit.Mvvm.ComponentModel;

namespace torch.ui.ViewModels;

public partial class MainWindowViewModel : ViewModelBase2
{
    public string Greeting => "Welcome to Avalonia!";
    
    
    // A collection of all navigation items.
    [ObservableProperty]
    private ObservableCollection<NavigationItemViewModel> _navigationItems;

    // The currently selected navigation item.
    [ObservableProperty]
    private NavigationItemViewModel? _selectedNavigationItem;
    
    public MainWindowViewModel()
    {
        // Populate the navigation menu.
        // The icon codes are Unicode characters from FontAwesome.
        _navigationItems = new ObservableCollection<NavigationItemViewModel>
        {
            new(new HomeViewModel(), "\uf015", "首页"),
            new(new MarketplaceViewModel(), "\uf290", "软件广场"),
            new(new CustomizeViewModel(), "\uf0ad", "软件定制"),
            new(new SettingsViewModel(), "\uf013", "系统设置"),
            new(new ProfileViewModel(), "\uf007", "我的")
        };

        // Set the default selected item to "首页".
        _selectedNavigationItem = _navigationItems[0];
    }
}